<?php
/**
 * Created by PhpStorm.
 * User: rocky
 * Date: 2019-07-14
 * Time: 01:24
 */

namespace app\shop\resource;

use app\common\resource\BaseResource;

class CouponResoure extends BaseResource
{
    public function toArray($data)
    {
        $name = $data['coupon']['store']['name'];
        if (!$name){
            $name = '平台';
        }
        return [
            'id' => $data['id'],
            'type' => $data['type'],
            'store_id' =>$data['coupon']['store_id'],
            'title' => $data['coupon']['title'],
            'name' => $name,
            'condition_price' => $data['coupon']['condition_price'],
            'cut_price' => $data['coupon']['cut_price'],
            'end_time' => $data['coupon']['end_time']
        ];
    }

}